/*
 * tilesetTiles.hpp
 *
 *  Created on: Aug 9, 2013
 *      Author: jason
 */

#ifndef TILESETTILES_HPP_
#define TILESETTILES_HPP_

#include <string>

namespace Tmx {
// Bits on the far end of the 32-bit global tile ID are used for tile flags
const unsigned FLIPPED_HORIZONTALLY_FLAG = 0x80000000;
const unsigned FLIPPED_VERTICALLY_FLAG   = 0x40000000;
const unsigned FLIPPED_DIAGONALLY_FLAG   = 0x20000000;

struct Tiles {
	Tiles() {
		tilesetID = 0;
		flippedHoriz = 0;
		flippedVert = 0;
		flippedDiag = 0;
		id = 0;
	}
	Tiles(int _gid, int _tilesetFirstID, int _tilesetID) {
		tilesetID = _tilesetID;
		flippedHoriz = (_gid & FLIPPED_HORIZONTALLY_FLAG);
		flippedVert = (_gid & FLIPPED_VERTICALLY_FLAG);
		flippedDiag = (_gid & FLIPPED_DIAGONALLY_FLAG);
		id = _gid;
		id &= ~(FLIPPED_HORIZONTALLY_FLAG |
                FLIPPED_VERTICALLY_FLAG |
                FLIPPED_DIAGONALLY_FLAG);
		//id -= _tilesetFirstID;
	}
	int id;
	int tilesetID;
	bool flippedHoriz;
	bool flippedVert;
	bool flippedDiag;
}; // struct Tiles
}; // namespace Tmx


#endif /* TILESETTILES_HPP_ */
